*{ You can use plain selenium command using the selenium tag }*

#{selenium}
    // Open the home page, and check that no error occured
    open('/')
    assertNotTitle('Application error')
#{/selenium}

#{fixture delete:'all', load:'data.yml' /}

#{selenium}
    // Open the home page, and check that no error occurred
    open('/')
    waitForPageToLoad(1000)
    assertNotTitle('Application error')
#{/selenium}

#{fixture delete:'all', load:'data.yml' /}

#{selenium}
    clearSession()

    // Open the home page, and check that no error occurred
    open('/')
    waitForPageToLoad(1000)
    assertNotTitle('Application error')
#{/selenium}

#{fixture delete:'all', load:'data.yml' /}

#{selenium 'Check home page'}
    clearSession()

    // Open the home page
    open('/')

    // Check that the front post is present
    assertTextPresent('About the model layer')
    assertTextPresent('by Bob, 14 Jun 09')
    assertTextPresent('2 comments , latest by Guest')
    assertTextPresent('It is the domain-specific representation')

    // Check older posts
    assertTextPresent('The MVC application')
    assertTextPresent('Just a test of YABE')
#{/selenium}

#{selenium 'Test comments'}

    // Click on 'The MVC application post'
    clickAndWait('link=The MVC application')
    assertTextPresent('The MVC application')
    assertTextPresent('no comments')

    // Post a new comment
    type('content', 'Hello')
    clickAndWait('css=input[type=submit]')

    // Should get an error
    assertTextPresent('no comments')
    assertTextPresent('Author is required')
    type('author', 'Me')
    type('content', 'Hello')
    type('code', 'XXXXX')
    clickAndWait('css=input[type=submit]')

    // Check
    assertTextPresent('Thanks for posting Me')
    assertTextPresent('1 comment')
    assertTextPresent('Hello')
#{/selenium}